package cn.com.csg.smartenergy.common;

import java.util.Date;

/**
 * 获取表名
 */
public class TableNameUtils {

    /**
     * 获取表名
     *
     * @param tableNamePrefix
     * @param date
     * @return
     */
    public static String getTableName(String tableNamePrefix, Date date) {
        return tableNamePrefix + "_" + DateUtils.format(date, DateUtils.DATE_TIME_TABLE_NAME_YYYY_MM_DD);
    }

    /**
     * @param tableNamePrefix
     * @param ymd             pattern
     * @return
     */
    public static String getTableName2(String tableNamePrefix, String ymd, String pattern) {
        return tableNamePrefix + "_" + DateUtils.format(DateUtils.stringToDate(ymd, pattern), DateUtils.DATE_TIME_TABLE_NAME_YYYY_MM_DD);
    }

    /**
     * @param tableNamePrefix
     * @param ymd             yyyy_MM_dd
     * @return
     */
    public static String getTableName3(String tableNamePrefix, String ymd) {
        return tableNamePrefix + "_" + ymd;
    }

}
